<?php
/*
	本插件：$this->model('model')->方法名();
	其他地方调用：model('jy_yxw/model')->方法名();
*/
namespace jy_yxw;
defined('BY_JYA') or exit('error');
class banji extends \plugin{
	public function addyonghu($postdata,$storeid=0){
		if(!$postdata['memberid']){
			exi('请选择要分班的客户！','error');
		}
		if(!$postdata['classid']){
			exi('请选择售后群！','error');
		}
		$class=$this->get('class',array('id'=>$postdata['classid'],'uniacid'=>$_SESSION['uniacid']));
		$data=array(
			'memberid'=>$postdata['memberid'],
			'classid'=>$postdata['classid'],
			'title'=>$postdata['title'],
			'from_type'=>$postdata['from_type'],
			'title'=>$postdata['title'],
			'sn'=>'SN'.get_ordersn($this->tablename('class'),'sn'),
			'fuwuid'=>$class['fuwuid'],
			'status'=>11,
		);
		$data['uniacid']=$_SESSION['uniacid'];
		$data['storeid']=$storeid?:$_SESSION['storeid'];
		$data['createtime']=time();
		pdo_insert('jy_yxw_yonghu',$data);
		$id=pdo_insertid();
		return $id;
	}
}
?>